package com.sunrise.generico.entidade;

import java.math.BigDecimal;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import lombok.Getter;
import lombok.Setter;

import org.hibernate.validator.constraints.NotEmpty;

import com.sunrise.generico.entidade.iface.EntidadeManter;

@Entity
@Table(name = "produto")
public class Produto implements EntidadeManter {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3070159621011097321L;

	@Id
	@SequenceGenerator(name="pk_sequence",sequenceName="produto_id_seq", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="pk_sequence")
	@javax.persistence.Column
	@Getter @Setter
	private Long id;
	
	@Column(name = "nome", length = 100, nullable = false)
	@NotEmpty( message="{nomeProdutoObrigatorio}")
	@Getter @Setter
	private String nome;
	
	@Column(name = "codigoFornecedor", length = 100)
	@Getter @Setter
	private String codigoFornecedor;
	
	@Column(name = "cfop")
	@Getter @Setter
	private Integer cfop;
	
	@Column(name = "custo", precision = 9, scale = 2, nullable = false)
	@Getter @Setter
	private BigDecimal custo;
	
	@Column(name = "precoVenda", precision = 9, scale = 2)
	@Getter @Setter
	private BigDecimal precoVenda;

	@Column(name = "cEAN", length = 14)
	@Getter @Setter
	private String cEAN;
	
	@Column(name = "cEANTrib", length = 14)
	@Getter @Setter
	private String cEANTrib;
	
	@Column(name = "NCM", length = 8)
	@Getter @Setter
	private String NCM;

	@OneToMany
	@Getter @Setter
	private Collection<Estoque> estoque;

	@Column(name = "descricao", length = 120)
	@Getter @Setter
	private String descricao;
	
	@OneToOne
	@Getter @Setter
	private IPI ipi;
	
	@OneToOne
	@Getter @Setter
	private ICMS icms;
	
	@OneToOne
	@Getter @Setter
	private PIS pis;
	
	@OneToOne
	@Getter @Setter
	private Cofins cofins;
	
	@ManyToOne
	@Getter @Setter
	private Marca marca;
	
	@ManyToOne
	@Getter @Setter
	private Cor cor;
	
	@ManyToOne
	@Getter @Setter
	private Colecao colecao;
	
	@ManyToOne
	@Getter @Setter
	private Linha linha;

	@ManyToOne
	@Getter @Setter
	private Setor setor;
	
	@ManyToOne
	@Getter @Setter
	private Unidade unidade;
	
	@ManyToOne
	@Getter @Setter
	private Tamanho tamanho;
	
	@Enumerated
	@Getter @Setter
	private Boolean ativo;
	
}
